#include <tcr.cc>
#include <iostream>

using namespace std;

int main()
{
	int n, ii, m;
	int x, y;
	Point pts[10000], hull[10000];
	while(scanf("%d", &n) != EOF && n != 0)
	{

		for(ii = 0; ii < n; ii++)
		{
			scanf("%d %d", &x, &y);
			pts[ii].x = x, pts[ii].y = y, pts[ii].z = 1;
		}

		convex_hull(pts, n, hull, &m);

		printf("%d\n", m);
		for(ii = 0; ii < m; ii++)
			cout << hull[ii].x << " " <<  hull[ii].y << endl;
		printf("\n");
	}

	return 0;
}
